package cate.game.farm.local.island;

import cate.common.table.d.GDIsland;
import cate.game.GameBody;
import cate.game.db.mongo.kv.KvMongo;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.ToString;

@ToString
@NoteClass(value = "迷失神庙数据")
public class IslandSPO extends KvMongo {
    @NoteField(value = "当前记录的周期")
    public int weekNo;

    @Override
    public String getKeyPrefix() {
        return KvMongo.KEY_ISLAND;
    }

    public void initialize(GameBody game) {
        checkCycle(game);
    }

    public void checkCycle(GameBody game){
        // 目前是开服第几天
        int openDay = game.status.getOpenDay();
        // 当天应该是第几个周期
        int currentWeekNo = (openDay + 1) / GDIsland.CYCLE;
        // 判断当前周期
        if (this.weekNo != currentWeekNo) {
            this.weekNo = currentWeekNo;
        }
    }
}
